package com.prs.crm.dao.crm.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Property;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.crm.CustomerAddressDao;
import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.domain.crm.CustomerAddress;
import com.prs.crm.domain.crm.Fault;

public class CustomerAddressDaoImpl extends BaseDaoImpl<CustomerAddress> implements CustomerAddressDao{

	@Override
	public List<CustomerAddress> getAddressByAddress(
			CustomerAddress customerAddress) {
		Criteria criteria = this.getSession().createCriteria(CustomerAddress.class);
		criteria.add(Property.forName("customerAddress").eq(customerAddress));
		return criteria.list();
	}

	@Override
	public List<CustomerAddress> getAddressFather() {
		Criteria criteria = this.getSession().createCriteria(CustomerAddress.class);
		criteria.add(Restrictions.isNull("customerAddress"));
		return criteria.list();
	}

	@Override
	public List<CustomerAddress> getAllAddress() {
		Criteria criteria = this.getSession().createCriteria(CustomerAddress.class);
		//criteria.add(Restrictions.isNull("customerAddress"));
		return criteria.list();
	}
	
}
